import axios from '@utils/http/request'
import { HospitalSetList, ReqAddHospitalParams, ReqHospitalSetListParams, ReqHospitalSetListResponse, ReqUpdateHospitalParams } from './model/hospitalSetType'
// 定义请求函数
export function reqGetHospitalSetList ({page,limit,hosname,hoscode}:ReqHospitalSetListParams){

    // 发送请求到后端接口,并限制返回类型
   return axios.get<any,ReqHospitalSetListResponse>(`/admin/hosp/hospitalSet/${page}/${limit}`,{
        params:{
            hosname:hosname,
            hoscode:hoscode,
        }
    })
}
export function reqAddHospital(hospitalSet:ReqAddHospitalParams){
    return axios.post('/admin/hosp/hospitalSet/save',hospitalSet)
}
// 获取但个医院的设置
export function reqGetHospital(id:string){
    return axios.get(`/admin/hosp/hospitalSet/get/${id}`)
}
// 修改医院的设置
export function reqUpdateHospital(hospitalSet:ReqUpdateHospitalParams){
    return axios.put<any,null>('/admin/hosp/hospitalSet/update',hospitalSet)
}
// 删除指定的医院
export function reqRemoveHospital(id:number){
    return axios.delete<any,null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

// 删除选中的说有医院
export function reqRemoveHospitalList(idList:React.Key[]){
    return axios.delete<any,null>('/admin/hosp/hospitalSet/batchRemove',{
        data:idList
    })
}